<!DOCTYPE html> 
 
<html lang="en"> 
  <head> 
    <meta charset="utf-8"> 
    <title>插件开发</title> 
    <style type="text/css">
     
    </style>
    <script language="javascript" src="js/jquery-1.11.1.js"></script>
    <script language="javascript" src="js/dora.js"></script>
    <script type="text/javascript">

    $(function(){

       var $invBody = $('#inventory tbody');
       var priseMaps = $invBody.find('td:nth-child(2)').map(function(item, index) {
         return $(index).text();
       }).get();

       var priseMaps1 = $invBody.find('td:nth-child(3)').map(function(item, index) {
         return $(index).text();
       }).get();


       var totalPrise = $.doraMathUtils.sum(priseMaps);
       var totalPrise1 = $.doraMathUtils.sum(priseMaps1);

       var avPrise = $.doraMathUtils.averageValue(priseMaps);
       var avPrise1 = $.doraMathUtils.averageValue(priseMaps1);
       // 求和
       $('#sum').find('td:nth-child(2)').text(totalPrise);
        $('#sum').find('td:nth-child(3)').text(totalPrise1);

        // 求平均值
         $('#average').find('td:nth-child(2)').text(avPrise);
        $('#average').find('td:nth-child(3)').text(avPrise1);


        var currentTxt = $.doraMathUtils.cutText($('#shadowTest').text(),16)

        $('#shadowTest').text(currentTxt);

        // 阴影测试
        $('#shadowTest').setShadow({
          opacity: 0.2,
          copysNum:3
        });

        
    })
    </script>
  </head> 
 
  <body>  
    <h3 id="shadowTest">This is a shadow Test</h3>
    <table id="inventory"> 
      <thead> 
        <tr class="one"> 
          <th>Product</th> <th>Quantity</th> <th>Price</th> 
        </tr> 
      </thead> 
      <tfoot> 
        <tr class="two" id="sum"> 
          <td>Total</td> <td></td> <td></td> 
        </tr> 
        <tr id="average"> 
          <td>Average</td> <td></td> <td></td> 
        </tr> 
      </tfoot> 
      <tbody> 
        <tr> 
          <td><a href="spam.html" data-tooltip-text="Nutritious and delicious!">Spam 
          </a></td> <td>4</td> <td>2.50</td> 
        </tr> 
        <tr> 
          <td><a href="egg.html" data-tooltip-text="Farm fresh or scrambled!">Egg</a> 
          </td> <td>12</td> <td>4.32</td> 
        </tr> 
        <tr> 
          <td><a href="gourmet-spam.html" data-tooltip-text="Chef Hermann's recipe."> 
          Gourmet Spam</a></td> <td>14</td> <td>7.89</td> 
        </tr> 
      </tbody> 
    </table>
  </body> 
</html>